#!/bin/sh
# restore busybox's imperfection
bblinks="bzip2 bunzip2 bzcat"
[ -z "$IPKG_INSTROOT" ] && bbhelp=$(/bin/busybox --help 2>/dev/null)
for bblink in $bblinks; do
	rm -f $IPKG_INSTROOT/usr/bin/${bblink}.bb 2>/dev/null
	rm -f $IPKG_INSTROOT/usr/bin/$bblink 2>/dev/null
	if [ -n "$IPKG_INSTROOT" ]; then
		ln -sf ../../bin/busybox $IPKG_INSTROOT/usr/bin/$bblink 2>/dev/null
	else
		echo "$bbhelp" | grep -q "[[:space:]]$bblink\>" && ln -sf ../../bin/busybox $IPKG_INSTROOT/usr/bin/$bblink 2>/dev/null
	fi
done
